﻿using mvcForum.Core.Interfaces.Data;
using System;
using System.Linq.Expressions;

namespace mvcForum.Core.Specifications {

	public static class ForumTrackSpecifications {

		public class SpecificForum : ISpecification<ForumTrack> {
			private readonly Forum forum;

			public SpecificForum(Forum forum) {
				this.forum = forum;
			}

			public Expression<Func<ForumTrack, Boolean>> IsSatisfied {
				get {
					return x => x.ForumId == forum.Id;
				}
			}
		}

		public class SpecificForumAndUser : ISpecification<ForumTrack> {
			private readonly Forum forum;
			private readonly ForumUser user;

			public SpecificForumAndUser(Forum forum, ForumUser user) {
				this.forum = forum;
				this.user = user;
			}

			public Expression<Func<ForumTrack, Boolean>> IsSatisfied {
				get {
					return x => x.ForumId == forum.Id && x.ForumUserId == user.Id;
				}
			}
		}
	}
}